from time import sleep

from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select

print('@GeekChunky')
print('\nThis automation plug-in is based on \"WebDriver\" configured \"Microsoft Edge\" browser.\n')

driver = webdriver.Edge(r'C:\Users\caiyo\AppData\Local\Programs\Python\Python38\BroswerDriver\msedgedriver.exe')
# driver.maximize_window()
driver.minimize_window()
print('脚本执行中...请不要关闭此窗口')
driver.get('http://192.168.3.206/')
driver.execute_script("document.body.style.zoom='1'")
driver.find_element(By.XPATH, '//*[@id="edit_body"]/div[2]/div[2]/form/input[3]').clear()
driver.find_element(By.XPATH, '//*[@id="edit_body"]/div[2]/div[2]/form/input[3]').send_keys('15581641767')
driver.find_element(By.XPATH, '//*[@id="edit_body"]/div[2]/div[2]/form/input[4]').clear()
driver.find_element(By.XPATH, '//*[@id="edit_body"]/div[2]/div[2]/form/input[4]').send_keys('064613')
sleep(1)
Select(driver.find_element(By.XPATH, '//*[@id="edit_body"]/div[2]/div[2]/select')).select_by_visible_text('中国联通')
sleep(1)
driver.find_element_by_xpath('//*[@id="edit_body"]/div[2]/div[2]/form/input[2]').click()

driver.refresh()
driver.find_element_by_xpath('//*[@id="edit_body"]/div[2]/div[2]/form/input[2]').click()
driver.refresh()
driver.find_element_by_xpath('//*[@id="edit_body"]/div[2]/div[2]/form/input[2]').click()
driver.refresh()
driver.find_element_by_xpath('//*[@id="edit_body"]/div[2]/div[2]/form/input[2]').click()
driver.refresh()
driver.find_element_by_xpath('//*[@id="edit_body"]/div[2]/div[2]/form/input[2]').click()
driver.refresh()
driver.find_element_by_xpath('//*[@id="edit_body"]/div[2]/div[2]/form/input[2]').click()
driver.refresh()
driver.find_element_by_xpath('//*[@id="edit_body"]/div[2]/div[2]/form/input[2]').click()

# element = driver.find_element_by_xpath('//*[@id="edit_body"]/div/div[1]/form/input')
# while True:
#     if element !=  None:
#         element.click()
#         driver.find_element_by_xpath('//*[@id="edit_body"]/div[2]/div[2]/form/input[2]').click()
#     else:
#         break
